import { defineStore } from "pinia";
import { userVip } from "../api/user.js";
import { dateFormat } from "../utils/date";
export const vipMin = defineStore("vipMin", {
  state: () => {
    return {
        vipData: {}
    };
  },
  getters: {},

  actions: {
    async getUserVipData(login, password) {
      try {
        const res = await userVip()
        if (res.data.errno == 0) {
          this.vipData = res.data;
        }
      } catch (error) {
        // 让表单组件显示错误
        return error
      }
    },
  },

  persist: {
    enabled: true,
    detached: true,
    strategies: [
      {
        key: "balance",
        storage: sessionStorage,
        paths: ["balance"]
      },
    ]
  }
});
